package com.movitech.mobile.cz.base.purchase.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.movitech.mobile.cz.base.common.util.CommonConstants;
import com.movitech.mobile.cz.base.modules.controller.RestReturnResult;
import com.movitech.mobile.cz.base.purchase.entity.WFlowFormSuppliersQuestion;
import com.movitech.mobile.cz.base.purchase.entity.ext.ExtWFlowFormSuppliersQuestion;
import com.movitech.mobile.cz.base.purchase.mapper.WFlowFormSuppliersQuestionMapper;
import com.movitech.mobile.cz.base.purchase.mapper.ext.ExtWFlowFormSuppliersQuestionMapper;
import com.movitech.mobile.cz.base.purchase.service.WFlowFormSuppliersQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 流程表单-答疑补遗-供方质疑 服务实现类
 * </p>
 *
 * @author Movitech Mobile
 * @since 2018-03-15
 */
@Service
public class WFlowFormSuppliersQuestionServiceImpl extends ServiceImpl<WFlowFormSuppliersQuestionMapper, WFlowFormSuppliersQuestion> implements WFlowFormSuppliersQuestionService {
    @Autowired
    private ExtWFlowFormSuppliersQuestionMapper extWFlowFormSuppliersQuestionMapper;
    @Override
    public RestReturnResult getSuppliersQuestion(String flowId) {
        RestReturnResult<Object> hResult=RestReturnResult.error();
        EntityWrapper wrapper = new EntityWrapper<>();
        WFlowFormSuppliersQuestion wFlowFormSuppliersQuestion=new WFlowFormSuppliersQuestion();
        wFlowFormSuppliersQuestion.setFlowFormId(flowId);
        wFlowFormSuppliersQuestion.setDelFlag(CommonConstants.DEL_FLAG_NORMAL);
        wrapper.setEntity(wFlowFormSuppliersQuestion);
        wrapper.orderBy(" update_date ",false);
        List<WFlowFormSuppliersQuestion> ls=this.selectList(wrapper);
        hResult=RestReturnResult.success();
        hResult.setData(ls);
        return hResult;
    }

    @Override
    public List<ExtWFlowFormSuppliersQuestion> findExtByMap(Map<String,Object> param) {
        return extWFlowFormSuppliersQuestionMapper.getByMap( param);
    }


}
